<?php
/* 
 * @author Jens Beyer
 * @date 04-09-2012
 */
//require_once('D:/Programme/Xampp/htdocs/Game/includes/Init.php');
class Ajax_Model_Galery extends Ajax_Model
{
    public function __construct()
    {
        error_log("\n create GAlery OB \n");
    }
    
    protected $_fetchedData;

    public function fetch()
    {
//        echo $_SERVER['DOCUMENT_ROOT'];
        $at = Controller::getActionTemplate();
        $queryPicture = $_POST['q'];
        if(!empty($queryPicture)) {
            $at->assign('bigFile', $queryPicture);
            $this->_fetchedData = $at->fetch(getDocumentRoot() . "templates/mainBig.tpl");
        } else {
            $getFiles = new GetFiles();
            $getFiles->getAllGaleriaFiles();
            //echo "";
            $this->_fetchedData = $at->fetch(getDocumentRoot() . "templates/galeria.tpl");
        }
        return $this;
    }

    public function returnAjax()
    {
        return $this->_fetchedData;
    }
}

